<html>
	<head>
		<meta charset="utf-8">
		<link rel="stylesheet" type="text/css" href="css/style.css" />
		<script type="text/javascript" src="js/index.js"></script>
		<title>口罩管理系统</title>
	</head>
	<body>
		<h1>口罩管理系统</h1>
		<table>
			<tr>
				<td>名称:</td>
				<td>
					<input type="text" name="name" >
				</td>
			</tr>
			<tr>
				<td>售价:</td>
				<td>
					<input type="text" name="result" >
				</td>
			</tr>
			<tr>
				<td>数量:</td>
				<td>
					<input type="text" name="sl" >
				</td>
			</tr>
			<tr>
				<td>品质:</td>
				<td>
					<input type="text" name="pz" >
				</td>
			</tr>
			<tr>
				<td colspan="4">
					<button onclick="insert()">添加</button>
				</td>
			</tr>
		</table>
		<script type="text/javascript">
			function insert(){
				let name=document.getElementsByName("name")[0].value;
				let result=document.getElementsByName("result")[0].value;
				let sl=document.getElementsByName("sl")[0].value;
				let pz=document.getElementsByName("pz")[0].value;
				let ajax=getAjax();
				ajax.open("POST","./server/insert_server.php",false);
				ajax.setRequestHeader("Content-type","application/x-www-form-urlencoded;charset = UTF-8");
				ajax.send("name="+name+"&result="+result+"&sl="+sl+"&pz="+pz);
				alert(ajax.responseText);
				window.location.href="index.php";
			}
		</script>
	</body>
</html>